Skip to content

python: serve module calls from one warm process when opted in - #92

Draft
eunomie wants to merge 4 commits into
mainfrom
python-module-serve
Draft

eunomie wants to merge 4 commits into
mainfrom
python-module-serve

Conversation

@eunomie

@eunomie eunomie commented Nov 12, 2026

Copy link
Copy Markdown
Member

python -m dagger.mod serve runs a loop that serves module calls from one warm process.

  • It imports the module once and listens on loopback.
  • It takes one call per connection.
  • Each call gets its own session.
  • After each call it restores file descriptors, environment and working directory.

Generation emits the serve entrypoint member only for a module with serve = true under [tool.dagger]. A module that does not opt in generates exactly what it generates today.

This needs the engine change in dagger/dagger#15157 (dagger/dagger#15157) to have any effect. On a released engine, an opted-in module still works, with every call in a new process; that was verified.

Tests: 186 unit tests pass. A README section describes the option.

Signed-off-by: Yves Brissaud <yves@dagger.io>
Signed-off-by: Yves Brissaud <yves@dagger.io>
v1.0.11 pins its Dang modules to Dang 2.1, so they keep loading on
engines that default to Dang 2.4.

Signed-off-by: Yves Brissaud <yves@dagger.io>
Signed-off-by: Yves Brissaud <yves@dagger.io>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant